package com.lanbu.web.controller.system;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.lanbu.common.annotation.Log;
import com.lanbu.common.core.controller.BaseController;
import com.lanbu.common.core.domain.AjaxResult;
import com.lanbu.common.enums.BusinessType;
import com.lanbu.system.domain.ZntEvaluation;
import com.lanbu.system.service.IZntEvaluationService;
import com.lanbu.common.utils.poi.ExcelUtil;
import com.lanbu.common.core.page.TableDataInfo;

/**
 * 用户评估记录Controller
 *
 * @author lanbu
 * @date 2025-04-24
 */
@Api(tags = "用户评估记录Controller")
@RestController
@RequestMapping("/chat/evaluation")
public class ZntEvaluationController extends BaseController
{
    @Autowired
    private IZntEvaluationService zntEvaluationService;


    @ApiOperation("查询用户评估记录列表")
    @PreAuthorize("@ss.hasPermi('chat:evaluation:list')")
    @GetMapping("/list")
    public TableDataInfo list(ZntEvaluation zntEvaluation)
    {
        startPage();
        List<ZntEvaluation> list = zntEvaluationService.selectZntEvaluationList(zntEvaluation);
        return getDataTable(list);
    }


    @ApiOperation("导出用户评估记录列表")
    @PreAuthorize("@ss.hasPermi('chat:evaluation:export')")
    @Log(title = "用户评估记录", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, ZntEvaluation zntEvaluation)
    {
        List<ZntEvaluation> list = zntEvaluationService.selectZntEvaluationList(zntEvaluation);
        ExcelUtil<ZntEvaluation> util = new ExcelUtil<ZntEvaluation>(ZntEvaluation.class);
        util.exportExcel(response, list, "用户评估记录数据");
    }


    @ApiOperation("获取用户评估记录详细信息")
    @PreAuthorize("@ss.hasPermi('chat:evaluation:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(zntEvaluationService.selectZntEvaluationById(id));
    }


    @ApiOperation("新增用户评估记录")
    @PreAuthorize("@ss.hasPermi('chat:evaluation:add')")
    @Log(title = "用户评估记录", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody ZntEvaluation zntEvaluation)
    {
        return toAjax(zntEvaluationService.insertZntEvaluation(zntEvaluation));
    }

    @ApiOperation("修改用户评估记录")
    @PreAuthorize("@ss.hasPermi('chat:evaluation:edit')")
    @Log(title = "用户评估记录", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody ZntEvaluation zntEvaluation)
    {
        return toAjax(zntEvaluationService.updateZntEvaluation(zntEvaluation));
    }


    @ApiOperation("删除用户评估记录")
    @PreAuthorize("@ss.hasPermi('chat:evaluation:remove')")
    @Log(title = "用户评估记录", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(zntEvaluationService.deleteZntEvaluationByIds(ids));
    }
}
